import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    username: '',
    password: '',
    token: sessionStorage.getItem('z_token')
  },
  mutations: {
    SET_USERNAME (state, data) {
      state.username = data
    },
    SET_PASSWORD (state, data) {
      state.password = data
    },
    SET_TOKEN (state, data) {
      state.token = data
    },
    OUT_LOGIN (state, data) {
      sessionStorage.removeItem('z_token')
      state.token = ''
    }

  },
  actions: {
  },
  modules: {
  }
})
